package com.jy.tradingOrder.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.jy.tradingOrder.serivce.TradingOrderService;

@Controller
@RequestMapping(value = "/tradingOrder")
public class TradingOrderController {
	
	@Autowired
	private TradingOrderService tradingOrderService;
	
	@RequestMapping(value = "/findAll")
	@ResponseBody
	public List<HashMap<String, Object>> findAll(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) {
		Map<String, Object> params = new HashMap<String, Object>();
		return tradingOrderService.getTradingOrderList(params);
	}
	
	@RequestMapping(value = "/addTradingOrderInfo")
	@ResponseBody
	public Map<String, Object> addTradingOrderInfo(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws JsonProcessingException {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("name", "王大锤");
		params.put("age", "19岁");
		params.put("moblie", "17088888888");
		tradingOrderService.addTradingOrderInfo(params);
		return params;
	}
}
